home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / HackintoshBiblev1.3.sit / Hackintosh Bible v1.3.rsrc / TEXT_155.txt < prev    next >
Text File  |  1996-11-10  |  25KB  |  444 lines

  1. How to Crack: MAC [by The Vassal] 
  2.  
  3. Hopefully this will be an informative work. One in which I will attempt to
  4. instruct you all how to successfully remove some of the more basic Mac protection
  5. schemes easily, the right way. Before we start anything, however, there are a few
  6. things that you will need. They are:
  7.  
  8. *  Mac Plus or better w/1 meg of RAM suggested
  9. *  MacsBug (Debugger from APDA)
  10. *  Programmer‚Äôs Key (Can invoke MacsBug from Keyboard)
  11. *  DisAsm 3.1 (Shareware disassembler)
  12. *  FEdit 3.21 (Shareware Sector editor)
  13. ...and 
  14. *  A working knowledge of 68000 Assembler
  15.  
  16. Ok, whether or not you believe in Shareware, it is a good system and the programs
  17. mentioned above are all capable of being commercial packages, so please pay the
  18. tiny shareware fee so the authors will continue to make them better. Thanks.
  19.  
  20.  
  21. Chapter 1- It's a Scheme Game 
  22.  
  23. The first thing you should do before you crack any ware is to identify completely
  24. what scheme they are using to protect their ware. On the Mac, schemes are usually
  25. basic and easy to get around. Some of the more common ones include: 
  26.  
  27. *  Password Protection
  28. *  Serial Number Protection,
  29. *  Key Disk Protection
  30. *  Date Expiration Protection (for Betas usually) 
  31. *  HardWare Key Protection
  32.  
  33. We‚Äôll look at these schemes one at a time and I will provide examples for each
  34. later. Right now, I want to explain how to determine what protection is what.
  35. First off, before you do anything make a backup of the application you are going
  36. to tamper with. This way if you screw up you will have something to go back to
  37. later.
  38.  
  39. Ok, now when you launch the application a couple of different protection schemes
  40. will surface immediatly. If a dialog comes up immediatly and asks you to type
  41. something in, it is almost always a Password Protection Scheme or a Serial Number
  42. Scheme. Key Disk Protection Schemes will ask you to insert a floppy so it can
  43. read important data from it and then continue with the program as normal. The
  44. Date Expiration Protection Scheme is never really noticed until it expires, then
  45. everytime you run the program it will tell you it has expired and will then quit.
  46.  
  47. Probably the most overated protection scheme going is that of hardware 'key' or
  48. 'dangle' protection. Usually the software package would ship with a hardware
  49. device that you would connect to the ADB port, Serial Port, or SCSI port. The
  50. different methods of checking the hardware will be described in detail later on
  51. in this document. No need to swamp you with technical stuff just yet.
  52.  
  53. Chapter 2- The Tools of Cracking 
  54.  
  55. As I mentioned earlier you will need certain programs to help you along in the
  56. deprotection process.
  57.  
  58. MacsBug: Is a full-featured debugger that allows you to set traps in
  59.                  programs and then trace through instruction by
  60.                  instruction. This is an immeasurably useful program. It
  61.                  has loads of commands, but I only use these commands
  62.                  for cracking:
  63.  
  64. atb [trap]            ; lets you set a trap that which will break you into
  65. MacsBug if 
  66.                           the program tries to exectute it. Mac Traps are from
  67. A000-
  68.                           AFFF and do many different things like _Eject &
  69. _ExitToShell
  70.                           and stuff like that.
  71. atc                   ; this will clear all of the traps t hat you set with atb
  72. es                    ; quit current application and exit to shell
  73. ea                    ; quit current application then launch it again
  74.  G                    ; go. Continue the application as normal. Turn off MacsBug.
  75. GT [addr]             ; lets you GO from a selected address.
  76. il [addr] n           ; lists from selected address "n"= number of lines
  77. ?                     ; This displays the online help file, very useful
  78.  
  79. These are the commands I use most of the time. There are other commands which are
  80. more complicated and do some special things but there is no need to explain them
  81. here. I will do that in a future issue.
  82.  
  83. FEdit 3.21: This is a very good sector/file editor with good search functions for
  84. finding certain code and changing it. This is very much like any other editor so
  85. there is no need to explain its functions.
  86.  
  87. DisAsm 3.1: This is a disassembler, the only one I have seen on the Mac so far
  88. and it works pretty good. All functions are operated from the Menus, but the main
  89. ones I use are the Search functions. Like finding certain traps, are certain
  90. addresses. I don‚Äôt really use this much but if needed it is good to have a
  91. disassembler around. Sometimes MacsBug won‚Äôt quite work if a program steals
  92. memory away from it and DisAsm must be used as a last resort.
  93.  
  94. Programmer's Key: This is a nifty little INIT that lets you invoke MacsBug from
  95. the keyboard. Basically you hit the Command-Reset keys and it dumps you into
  96. MacsBug, you can also hit Control-Command-Reset to restart your computer. Which
  97. is kind of neat. I recommend using this instead of the hardware interupt switch
  98. on the machine itself, mostly because its a pain to keep reaching in back of your
  99. machine to do it.
  100.  
  101. Chapter 3- Assembly is the key to the crack
  102.  
  103. It is extremely important to have a background in Assembly language if you want
  104. to get far cracking. To tell you the truth I used to be into programming the
  105. Apple II and IIgs in Assembly language. When I moved over to the Mac, I found out
  106. everything was C and Pascal, which disturbed me. C and Pascal allow you to
  107. program without having a clue what is really going on. I don‚Äôt like the idea of
  108. it at all. Most people think cracking is something for people who know how to
  109. program, but the truth is, I haven‚Äôt written a damn thing for the Mac as far as
  110. applications go, because I don‚Äôt know how. I could probably write something in
  111. assembly, but I just don‚Äôt have a nice assembler like Merlin on the Mac.
  112.  
  113. Some day, I recommend you buy a good 68000 reference manual so you can learn the
  114. processor. That‚Äôs what I did but Apple II assembly knowledge helped me out alot.
  115. Assembly languange on the Mac is a bit more complicated than that of the Apple
  116. II; on the Mac memory is moved not loaded or stored.  
  117.  
  118. On the Apple II and IIgs there are three registers you would normally use to
  119. store data in. The A or Accumulator, the X Register, and the Y Register. The Mac
  120. has 16 registers that can be used in this manner. They are D0-D7 which are 8 data
  121. registers for storing data, they are all capable of holding 32-bits worth of
  122. data. You can access or change these the low 8-bits, the low 16-bits or all
  123. 32-bits, changing the low byte or word has no affect on the remaining unchanged
  124. portion. There are also 8 address registers from A0-A7 but A7 is usually used as
  125. a stack pointer for the 68020 and is also known as the SP in this situation. The
  126. address registers are basically the same as the data registers but they can only
  127. be accessed using all 32-bits. Changing the low word of an address register
  128. replicates the bit 15 in bits 16-31. This is called sign extension, which
  129. converts a two's complement 16-bit quantity into an equivalent 32-bit quantity.
  130.  
  131. Another register on the Mac worth noting is the program counter (PC) register.
  132. This holds the address of the next instruction to be executed, and is very useful
  133. in tracing code.
  134.  
  135. There are many more opcodes in the 68000 instruction set then there are in the
  136. 6502 or 65c816, too many to list here. In the crack examples I will explain
  137. everything very thoroughly so you can get an idea of what is going on, and
  138. understand it.  
  139.  
  140. MacsBug and DisAsm both list Assembler in the same manner. They list the address
  141. on the left hand side, the opcode and effected address or values in the middle
  142. and the hex values on the right hand side. This is how I will lit my code, but I
  143. will add in descriptions on what it is the code is actually doing. Here is an
  144. example of what I mean:
  145.  
  146. 611F04:   Move.L    D0,D1     ;2200     : this moves the contents of
  147.                                                            D0 into D1
  148.  
  149. That's just an example, but it is very common to see code like that. The thing
  150. that is cool about MacsBug is that it lists all of the Address and data registers
  151. on the left part of the screen from top to bottom along with other system
  152. registers.
  153.  
  154. Another important aspect of 68000 and higher processors is that they use branches
  155. the same way the Apple II did, only that there are many more different branch
  156. instructions and they are much more powerful.   Here are a examples of branch
  157. opcodes for the 68000 series processors (used in Macs):
  158.  
  159. Hex Instr.            Ex.               Meaning
  160.       [$60]            $60xx            BRA (BRanch Always). This instruction
  161. always 
  162.                                                     branches to an address $xx
  163. bytes in front of 
  164.                                                     where the instruction was
  165. passed.
  166.  
  167.       [$66]            $66xx            BNE (Branch if Not Equal). This
  168. instruction will 
  169.                                                     branch ahead $xx bytes in
  170. front of where the 
  171.                                                     instruction was just passed.
  172.  
  173. There are 16 in all but I would rather not make this publication into an
  174. Assembler Reference book. I will put out one of those in the future maybe. I do
  175. suggest getting a 68000 quick reference though. On we go.
  176.  
  177. Chapter 4 - Key Code Protection
  178.                 Example: Quick Format 7.0 
  179.  
  180. The first type of protection scheme I would like to explain is the Key Code
  181. Scheme. This is used in Quick Format 7.0, which is a Public Domain Shareware
  182. program that is very good at formatting floppies and designing your own labeling
  183. scheme those floppies. It is definately worth the Shareware fee, so I suggest if
  184. you like the program to buy it, you can probably find it on many online services
  185. and from user groups.
  186.  
  187. The author decided to put in a registration algorithm which requires its users to
  188. type in a key code to access the advanced features of the program. When you first
  189. launch the Quick Format 7.0 application, a dialog box comes up and asks you to
  190. enter in the key code. If no key code is entered or you hit the return key, the
  191. program would continue to run, but with the advanced options turned off.
  192.  
  193. The author is doing a couple of different little things. First, he is going to
  194. check somewhere within his resource files to see if the current application being
  195. used is registered. Usually there is a register byte in a resource somewhere in
  196. the app. He will then do a compare to see if it really is registered. If it is,
  197. it continues like normal, if it isn‚Äôt registered, it will jump to another routine
  198. which turns off the advanced options and then runs the app as normal.
  199.  
  200. There are a few options we have when deprotecting this app. We can use MacsBug to
  201. trace through for the routine, then disassemble it to see where it does the
  202. compare; or we can use ResEdit to find a resource that looks suspicious and
  203. delete it. The latter might be a little tedious and it is always much more
  204. interesting tracing through code.
  205.  
  206. Now we will deprotect Quick Format 7.0. For best results and for speed and memory
  207. purposes quit all other applications you are currently running. When you are back
  208. at the Finder, hit ‚ÄúCommand-Reset‚Äù or reach in back of your machine and press the
  209. hardware interrupt switch, this will activate MacsBug. Your screen should have
  210. cleared and you should be looking at a white screen with numbers on the left hand
  211. quadrant of the screen running from TOP to BOTTOM. Those numbers are the various
  212. addresses and registers in memory.
  213.  
  214. Running along the bottom of the screen from LEFT to RIGHT are two separate boxes.
  215. The box on the big box with the numbers in it is a disassembly of the location in
  216. memory you just broke into with MacsBug. The smaller box under it is the MacsBug
  217. command line. On the far left you should notice a blinking cursor. From the
  218. command line you can execute different commands to help you trace through
  219. programs, especially useful in deprotecting software. At the command line type
  220. ‚Äú?‚Äù (help). This will print up a list of different topics. If you keep hitting
  221. return it will give you information about each topic in the order they are shown
  222. on the screen. So play around and hit return a few times to get an idea of what
  223. commands you can use.
  224.  
  225. Now that you are done playing let‚Äôs get started. I almost always set a TRAP for
  226. an _InitGraf. You can do this by typing
  227.                              'ATB INITGRAF'
  228.  
  229. A message should appear above the disassembly box saying 'A-Trap Break at A86E
  230. (_InitGraf)' everytime. What this means is that the program will be stopped and
  231. MacsBug will take over everytime the program tries to execute an _InitGraf. This
  232. works the same way for all of the other trpas that the Mac toolbox has as well.
  233.  
  234. Ok, now type 'G' on the MacsBug command line. This should bring you right back to
  235. the Finder where you started, and you will regain control of your Mac. Locate
  236. Quick Format 7.0 and launch it. Almost immediately your screen should change back
  237. into the MacsBug screen. There should be a message saying 'A-Trap break at
  238. XXXXXXX : A86E (_InitGraf)'. This means when you launched the program, MacsBug
  239. halted it because the program tried to pass an _InitGraf trap. Now that the
  240. program is halted, you can TRACE through the program to find the copy protection.
  241. You may not successfully pinpoint the protection to any one specific area until
  242. you have traced through a number of times.
  243.  
  244. Use the 'T' command to trace through. The object is to continue hitting 'T' and
  245. return until the protection scheme comes up. Eventually it will. When you do get
  246. it up look at the last few lines of code that was passed and you should see
  247. something like this:
  248.  
  249. Addr            Instruction                     Hex Bytes
  250. 583834        JSR SETUPMEN                     4EBA FE14
  251. 583838        JSR INITIALI                     4EAD 02E2
  252. 58383C        JSR INITGLOB                     4EBA FEBE
  253. 583840        JSR VIRALCHE                     4EBA FF22
  254. 583844        JSR CHECKMOR                     4EBA F82A
  255.  
  256. Now, it‚Äôs pretty obvious from just looking at the labels they used that you can
  257. determine what is going on. In most cases people would not use LABELS like the
  258. ones above, but since it is shareware and not a $500 commercial package I can see
  259. why the author opted the easier route for programming ease. The first JSR would
  260. probably be him initializing his menus and stuff. The second JSR would be to
  261. initialize the screen and the fonts or whatever, the third JSR would be
  262. initializing the global variables he would need and the fourth would be to check
  263. for any virus, persay. The fifth however is the routine he uses to check if the
  264. program has been registered and brings up the dialog asking you to enter a key
  265. code. If it hasn‚Äôt been registered with the correct keycode the program turns off
  266. some options. But, that is not necessary, as by omitting this JSR CHECKMOR you
  267. will remove the check and the program will run with all options available. 
  268.  
  269. Write down the last 10 or so bytes on a piece of paper noting that 4EBA F82A is
  270. what you will have to change. Since you want to omit these bytes you are best off
  271. using two NOP (or No OPeration) commands. The hex value for a NOP is 4E71. Now
  272. run FEdit and open up the Quick Format 7.0 program and do a HEX SEARCH for the
  273. bytes you wrote down on the paper. Then change the proper values and you will be
  274. all set. Here is what you should be looking for and the change you should be
  275. making:
  276.  
  277. Byte Changes (You should find the SEARCH string only ONE TIME!)
  278.  
  279. Search : 4EBA FE14 4EAD 02E2 4EBA FEBE 4EBA FF22 4EBA F82A
  280. Change :                                         4E71 4E71
  281.  
  282. The protection showed above is obviously an easy scheme to get around, and to
  283. tell you the truth, there really aren‚Äôt that many hard schemes on the Mac, like
  284. there are or were on the Apple II. It is important to check the routine you are
  285. disabling. Sometimes variables (or globals) are passed in between different parts
  286. of protection schemes, if you skip the entire protection scheme there is a pretty
  287. good chance you will miss a variable (or global) getting passed and your program
  288. will crash on you in the future.
  289.  
  290. The best way to check is to use the program after you have initially deprotected
  291. it, if it works ok, then chances are no globals were passed. In the example
  292. above, all of the globals were passed in the prior two JSRs, which made things
  293. very easy. 
  294.  
  295. Chapter 5 - Serial Number Schemes 
  296.  
  297. Serial Number Protection Schemes are the same as Password Protection Schemes in
  298. most cases. Both are checked with memory using a compare instruction, but they do
  299. have differences. For example, certain serial number schemes are actually
  300. mathematical answers where the application will perform some complex arithmetic
  301. equation using such information as your name or company name, if the equations
  302. solution matches the serial number you type in the program will continue on like
  303. normal.
  304.  
  305. Some serial number schemes are easy and do not use any arithmetic all, some check
  306. to see if you enter a prime number, etc. There are many ways. Probably the most
  307. common is; the company making the software will add a resource to the application
  308. housing the serial number. When the package first loads, it will ask you for your
  309. serial number then will do a compare with the value entered and the value stored
  310. in the serial number resource.  
  311.  
  312. Chapter 6- Key Disk Protection Schemes 
  313.  
  314. There are a couple of different ways commercial software authors implement Key
  315. Disk Protection. Key disk protection essentially is software that requires the
  316. original floppy diskettes to run correctly. These types of programs come with an
  317. installer for copying them onto a hard drive. Some packages offer three installs
  318. to a hard drive; if you need more copies, you have to use the original disk each
  319. time you run that program.
  320.  
  321. Essentially what is happening here is this. On the floppy disk there are files
  322. with their INVISIBLE bit set meaning they will not bee seen or accounted for in
  323. the volume info. Therefore, if you try to copy the program onto a hard drive the
  324. invisible files will not be copied and the copy will not work properly. If you
  325. just turn the INVISIBILITY bit off using ResEdit and then copy the files, the
  326. program will work. But, this is only for programs that do not always need the key
  327. disk. Other programs require the key disk every time you run the application. In
  328. those cases, the key disk has a purposely bad block. When you run the
  329. application, it will read from the floppy and test the block‚Äôs status. If it is
  330. bad it will continue on knowing it is the original disk, it the block is ok it
  331. means that the program has been copied onto another disk which is not the
  332. original or key disk. The best way to operate around this scheme is to trace
  333. through the program to where it actually reads from the floppy, then change the
  334. BRANCH condition after the COMPARE. This will fool the program into always
  335. thinking that the block that is read is bad.
  336.  
  337.  
  338. Chapter 7- Date Expiration Schemes 
  339.  
  340. These schemes occur out of the blue without notice most of the time. Most apps
  341. that use this scheme are beta apps that are expected to be updated before too
  342. long or demos of games and such. There are only two ways to read the current date
  343. or time on a Macintosh, one is to use the _GetDateTime trap the other is to use
  344. the Macintosh Global variable memory address $020C at which the current number of
  345. seconds that has elapsed since Midnight, January 1st is stored. Basically both
  346. routines are extremely similar and would probably look something like this:
  347.  
  348. _GetDateTime (Protection Method)
  349.  
  350.           _GetDateTime               (Get current # of secs since 12am 01/01/04)
  351.           CMPI.L expiredate,D1 (Compare the date with expiration date)
  352.           BLE        notexpired       (If less than, then it hasn't expired)
  353.           JSR        EXPIRED!         (Otherwise show the dialog and bomb out!)
  354.  
  355.  Address $020C (Protection Method)
  356.  
  357.           CMPI.L expiredate,$020C (Compare the current date with expire date)
  358.           BGT        EXPIRED              (If current date is > then expire date,
  359. show dialog 
  360.                                                       & BOMB!)
  361.           ---------                       (otherwise it hasn't expired and
  362. everything is 
  363.                                                        ok!)
  364.  
  365. That should have given you some idea what the protection schemes look like, they
  366. vary of course but that is what they will normally be like. The simple way to
  367. disarm these routines is to change the Branch Condition, for instance in the
  368. first protection scheme shown above it would be extremely easy to change the BLE
  369. to a BRA which will automatically branch to the ‚Äúnotexpired‚Äù portion of the
  370. program. 
  371.  
  372. For the second routine has an easy way to eliminate the protection scheme. It
  373. would be to change the 'BGT EXPIRED' into two NOPs. Which will totally eliminate
  374. the check and fool the program into thinking everything is ok.  
  375.  
  376.  
  377. Chapter 8- Hardware Key Protection
  378.  
  379. Not many people know too much about this protection scheme. But one obvious
  380. observation is that companies are making there own devices and confused companies
  381. with low marketshare are buying into there hardware protection scheme, which
  382. really is not that good to tell you the truth.
  383.  
  384. Basically what the Eve‚Ñ¢ hardware key does is it hooks up to your ADB port and
  385. has a chip in it which can be read from. All of the packages I have seen that use
  386. the Eve‚Ñ¢ protection key come with an Eve INIT. Basically this INIT reads one or
  387. more values from the Eve key and stores it somewhere in memory. The program that
  388. will then do a Compare to the memory to see if the values match if they do then
  389. the program will continue, however if there is a null value found the program
  390. will warn you that the Eve Key is not present and then quit. If the value is
  391. incorrect it will tell you that you either have the Eve hooked up incorrectly or
  392. that you are using an Eve from a different software package.
  393.  
  394. The easiest way around the Eve Hardware key would be to change the Branch
  395. conditions of the checks it does 1) to locate Eve and 2) to compare the values.
  396. Once you have changed these branch conditions the program will work as it would
  397. have if the Eve protection had not been implemented.  
  398.  
  399. From what I have heard some software locations or other important data to the
  400. program is stored in the Eve‚Ñ¢ that may be needed upon run time. For example, if
  401. a program is encrypted and the decryption routine is stored on the Eve‚Ñ¢ key it
  402. would be almost impossible to deprotect the program without a valid Eve‚Ñ¢ key to
  403. work with.  
  404.  
  405. So, I would just use MacsBug the way we have been and just trace through for the
  406. checks. Eve‚Ñ¢ will let you know when something is wrong through the use of
  407. dialogs, so tracing is pretty easy. Find those branches and change the
  408. conditions.
  409.  
  410.  
  411. Chapter 9- The Ultimate Protection Scheme
  412.  
  413. This is a hotly debated topic. Most people would say that no protection scheme
  414. can go uncracked, but I beg to differ. I am sure I can stir something up that
  415. will boggle a few minds for at least 6 months of everyday tracing. Which will
  416. probably force that cracker to stop working on it.  
  417.  
  418. In this day and age all software should be unprotected and should be available
  419. through the Shareware system. Corporate America is crippling our economy and the
  420. only ones benefitting from it are the few 'elite' businessmen or businesswomen.
  421.  
  422. The Shareware system ensures that the people/programmers who put their time and
  423. effort into their projects recieve all of the money they bring in. Thats what
  424. Corporate America should be like. Spread the wealth amongst everyone. And work
  425. for the money you make, don‚Äôt cheat anyone out of it.
  426.  
  427. 'This article is written in memory of the old apple pirates who have paved the
  428. way for a new breed of "elite pirate" life form. Hadn't it been for their
  429. patience and instruction our generation of pirates would have died off long ago.
  430. Now I pass onto you my knowledge and ideas in hope that you will all use it,
  431. share it, work together with it and be "elite" toward one another. '
  432.                                                                                 
  433. The Vassal
  434.  
  435.  
  436. Many thanks to: Hipcheck, Agent Orange, The Terrorist and HackMan
  437.  
  438. Also thanks to: Far Side, Jim Heebner, Zelig, ShadowMan, The Embalmer, Mr_T, 
  439.                          The Wahoo, Grimm, Enigmatic Simplicity, Gandalf
  440. Greyhame,
  441.                          and (High Voltage for reminding me what the Apple II
  442. days were
  443.                          really like)...
  444.